﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace FlosMods.User.Configuration;

class UserConfiguration : IEntityTypeConfiguration<Models.User>
{
    public void Configure(EntityTypeBuilder<Models.User> builder)
    {
        builder.HasKey(u => u.ID);
        builder.Property(u => u.ID).ValueGeneratedOnAdd();
        builder.Property(u => u.Username).HasMaxLength(30).IsRequired();
        builder.Property(u => u.PasswordHash).HasMaxLength(44).IsRequired();
        builder.Property(u => u.PasswordSalt).HasMaxLength(22).IsRequired();
        builder.Property(u => u.Email).IsRequired();
        builder.Property(u => u.RegisterDate).IsRequired();
    }
}